<?php
/*
 * @Descripttion: 
 * @version: 1.0
 * @Author: Sam
 * date: 2021-12-01 09:56:57
 * @LastEditors: Sam
 * @LastEditTime: 2021-12-04 12:40:11
 */
db('mg_menu')
    ->whereOr("mg_module='{$mg_module}' and router = '{$mg_module}/Banner/banner_list'")
    ->whereOr("mg_module='{$mg_module}' and router = '{$mg_module}/Banner/add_banner'")
    ->whereOr("mg_module='{$mg_module}' and router = '{$mg_module}/Banner/edit_banner'")
    ->whereOr("mg_module='{$mg_module}' and router = '{$mg_module}/Banner/del_banner'")
    ->delete();
$parent_id = db('mg_menu')->insertGetId([
    'mg_module'     => $mg_module,
    'name'          => '轮播图管理',
    'module'        => $mg_module,
    'router'        => "$mg_module/Banner/index",
    'controller'    => 'Banner',
    'action'        => 'index',
    'icon'          => 'layui-icon-picture',
    'status'        => 1,
    'create_time'   => time()
]);
db('mg_menu')->insert([
    'mg_module'     => $mg_module,
    'parent_id'     => $parent_id,
    'name'          => '添加',
    'module'        => $mg_module,
    'router'        => "$mg_module/Banner/add",
    'controller'    => 'Banner',
    'action'        => 'add',
    'style'         => '',
    'status'        => 1,
    'icon'          => 'layui-icon-addition',
    'sort'          => 1,
    'create_time'   => time()
]);
db('mg_menu')->insert([
    'mg_module'     => $mg_module,
    'parent_id'     => $parent_id,
    'name'          => '编辑',
    'module'        => $mg_module,
    'router'        => "$mg_module/Banner/edit",
    'controller'    => 'Banner',
    'action'        => 'edit',
    'icon'          => 'layui-icon-edit',
    'style'         => 'layui-btn-xs layui-btn-normal',
    'status'        => 1,
    'sort'          => 2,
    'create_time'   => time()
]);
db('mg_menu')->insert([
    'mg_module'     => $mg_module,
    'parent_id'     => $parent_id,
    'name'          => '删除',
    'module'        => $mg_module,
    'router'        => "$mg_module/Banner/del",
    'controller'    => 'Banner',
    'action'        => 'del',
    'style'         => 'layui-btn-xs layui-btn-danger',
    'icon'          => 'layui-icon-delete',
    'status'        => 1,
    'sort'          => 3,
    'create_time'   => time()
]);